package xcmg.device.dao.mapper.warehouse;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.warehouse.WarehouseDeliveryDO;
import xcmg.device.dao.entity.warehouse.export.WarehouseDeliveryExportDO;
import xcmg.device.service.vo.warehouse.WarehouseDeliveryVO;

import java.util.List;

@Mapper
public interface WarehouseDeliveryMapper {
    int deleteByPrimaryKey(String id);

    int insert(WarehouseDeliveryDO record);

    WarehouseDeliveryDO selectByPrimaryKey(String id);

    int updateByPrimaryKey(WarehouseDeliveryDO record);

    List<WarehouseDeliveryDO> list(WarehouseDeliveryVO model);

    List<String> findOrderList(@Param("ids") List<String> ids);

    List<String> findIdsByBusinessOrders(@Param("businessOrders") List<String> businessOrders, @Param("orgId") String orgId);

    int remove(@Param("ids") List<String> ids);

    List<WarehouseDeliveryExportDO> findListForExport(@Param("ids") List<String> ids);

    int findCountForExportAll(WarehouseDeliveryVO model);

    List<WarehouseDeliveryExportDO> findListForExportAll(WarehouseDeliveryVO model);

    WarehouseDeliveryDO findByBusinessOrder(@Param("businessOrder") String businessOrder, @Param("orgId") String orgId);

    WarehouseDeliveryDO findByDeliveryOrder(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    /**
     * 根据业务单号修改事务单退货状态
     * @param businessOrder String 业务单号
     * @param status Integer 退货状态（0未退货，1退货）
     * @return int
     */
    int updateReturnStatus(@Param("businessOrder")String businessOrder,@Param("status")Integer status);

    int updateStateNoBarcode(@Param("status") Integer status, @Param("businessOrder") String businessOrder, @Param("orgId") String orgId);

    int updateReverseState(@Param("orderList")List<String> orderList, @Param("reverseState")Integer reverseState, @Param("orgId") String orgId);

    List<WarehouseDeliveryDO> listForVehicle(WarehouseDeliveryVO model);

    int findOutStatus(@Param("billNo")String billNo);

    int deleteByBusinessOrder(String id);

    int hardDeleteByBusinessOrder(@Param("businessOrder") String businessOrder,@Param("orgId") String orgId);
}